package com.livesource.client.web.repositoryLogin;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.PopupPanel;

/**
 * 
 * @UserManual
 */
public class ButtonSave extends Button {

	public ButtonSave(final String projectID, final PopupPanel popup) {

		this.setText("Save");

		this.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {

				Cookies.setCookie("repositoryUsername" + projectID, EncryptText
						.encrypt(RepositoryLoginPopup.username.getValue()));

				Cookies.setCookie("repositoryPassword" + projectID, EncryptText
						.encrypt(RepositoryLoginPopup.password.getValue()));

				popup.hide();
			}
		});

	}
}